clear 
set more off

#delimit ;
*  PSID DATA CENTER *****************************************************
   JOBID            : 253326                            
   DATA_DOMAIN      : IND                               
   USER_WHERE       : NULL                              
   FILE_TYPE        : All Individuals Data              
   OUTPUT_DATA_TYPE : ASCII                             
   STATEMENTS       : do                                
   CODEBOOK_TYPE    : PDF                               
   N_OF_VARIABLES   : 115                               
   N_OF_OBSERVATIONS: 69276                             
   MAX_REC_LENGTH   : 269                               
   DATE & TIME      : December 14, 2018 @ 14:04:36
*************************************************************************
;

infix
      ER30000              1 - 1           ER30001              2 - 5           ER30002              6 - 8     
      ER30283              9 - 12          ER30284             13 - 14          ER30285             15 - 15    
      ER30293             16 - 16          ER30313             17 - 20          ER30314             21 - 22    
      ER30315             23 - 23          ER30323             24 - 24          ER30343             25 - 28    
      ER30344             29 - 30          ER30345             31 - 31          ER30353             32 - 32    
      ER30373             33 - 36          ER30374             37 - 38          ER30375             39 - 39    
      ER30382             40 - 40          ER30399             41 - 44          ER30400             45 - 46    
      ER30401             47 - 48          ER30411             49 - 49          ER30429             50 - 53    
      ER30430             54 - 55          ER30431             56 - 57          ER30441             58 - 58    
      ER30463             59 - 62          ER30464             63 - 64          ER30465             65 - 66    
      ER30474             67 - 67          ER30498             68 - 71          ER30499             72 - 73    
      ER30500             74 - 75          ER30509             76 - 76          ER30535             77 - 80    
      ER30536             81 - 82          ER30537             83 - 84          ER30545             85 - 85    
      ER30570             86 - 89          ER30571             90 - 91          ER30572             92 - 93    
      ER30580             94 - 94          ER30606             95 - 98          ER30607             99 - 100   
      ER30608            101 - 102         ER30616            103 - 103         ER30642            104 - 108   
      ER30643            109 - 110         ER30644            111 - 112         ER30653            113 - 113   
      ER30689            114 - 117         ER30690            118 - 119         ER30691            120 - 121   
      ER30699            122 - 122         ER30733            123 - 126         ER30734            127 - 128   
      ER30735            129 - 130         ER30744            131 - 131         ER30806            132 - 136   
      ER30807            137 - 138         ER30808            139 - 140         ER30816            141 - 141   
      ER33101            142 - 146         ER33102            147 - 148         ER33103            149 - 150   
      ER33111            151 - 151         ER33201            152 - 156         ER33202            157 - 158   
      ER33203            159 - 160         ER33211            161 - 161         ER33301            162 - 165   
      ER33302            166 - 167         ER33303            168 - 169         ER33311            170 - 170   
      ER33401            171 - 175         ER33402            176 - 177         ER33403            178 - 179   
      ER33411            180 - 180         ER33501            181 - 185         ER33502            186 - 187   
      ER33503            188 - 189         ER33512            190 - 190         ER33601            191 - 194   
      ER33602            195 - 196         ER33603            197 - 198         ER33612            199 - 199   
      ER33701            200 - 204         ER33702            205 - 206         ER33703            207 - 208   
      ER33712            209 - 209         ER33801            210 - 214         ER33802            215 - 216   
      ER33803            217 - 218         ER33813            219 - 219         ER33901            220 - 224   
      ER33902            225 - 226         ER33903            227 - 228         ER33913            229 - 229   
      ER34001            230 - 234         ER34002            235 - 236         ER34003            237 - 238   
      ER34016            239 - 239         ER34101            240 - 244         ER34102            245 - 246   
      ER34103            247 - 248         ER34116            249 - 249         ER34201            250 - 254   
      ER34202            255 - 256         ER34203            257 - 258         ER34216            259 - 259   
      ER34301            260 - 264         ER34302            265 - 266         ER34303            267 - 268   
      ER34317            269 - 269   
using ./RawData/PSID_empvar.txt, clear 
;

label variable ER30000       "RELEASE NUMBER"                           ;
label variable ER30001       "1968 INTERVIEW NUMBER"                    ;
label variable ER30002       "PERSON NUMBER                         68" ;
label variable ER30283       "1979 INTERVIEW NUMBER"                    ;
label variable ER30284       "SEQUENCE NUMBER                       79" ;
label variable ER30285       "RELATIONSHIP TO HEAD                  79" ;
label variable ER30293       "EMPL STATUS                           79" ;
label variable ER30313       "1980 INTERVIEW NUMBER"                    ;
label variable ER30314       "SEQUENCE NUMBER                       80" ;
label variable ER30315       "RELATIONSHIP TO HEAD                  80" ;
label variable ER30323       "1980 EMPL STATUS                      80" ;
label variable ER30343       "1981 INTERVIEW NUMBER"                    ;
label variable ER30344       "SEQUENCE NUMBER                       81" ;
label variable ER30345       "RELATIONSHIP TO HEAD                  81" ;
label variable ER30353       "EMPLOYMENT STAT                       81" ;
label variable ER30373       "1982 INTERVIEW NUMBER"                    ;
label variable ER30374       "SEQUENCE NUMBER                       82" ;
label variable ER30375       "RELATIONSHIP TO HEAD                  82" ;
label variable ER30382       "EMPLOYMENT STATUS                     82" ;
label variable ER30399       "1983 INTERVIEW NUMBER"                    ;
label variable ER30400       "SEQUENCE NUMBER                       83" ;
label variable ER30401       "RELATIONSHIP TO HEAD                  83" ;
label variable ER30411       "EMPLOYMENT STATUS                     83" ;
label variable ER30429       "1984 INTERVIEW NUMBER"                    ;
label variable ER30430       "SEQUENCE NUMBER                       84" ;
label variable ER30431       "RELATIONSHIP TO HEAD                  84" ;
label variable ER30441       "EMPLOYMENT STAT                       84" ;
label variable ER30463       "1985 INTERVIEW NUMBER"                    ;
label variable ER30464       "SEQUENCE NUMBER                       85" ;
label variable ER30465       "RELATIONSHIP TO HEAD                  85" ;
label variable ER30474       "EMPLOYMENT STAT                       85" ;
label variable ER30498       "1986 INTERVIEW NUMBER"                    ;
label variable ER30499       "SEQUENCE NUMBER                       86" ;
label variable ER30500       "RELATIONSHIP TO HEAD                  86" ;
label variable ER30509       "EMPLOYMENT STAT                       86" ;
label variable ER30535       "1987 INTERVIEW NUMBER"                    ;
label variable ER30536       "SEQUENCE NUMBER                       87" ;
label variable ER30537       "RELATIONSHIP TO HEAD                  87" ;
label variable ER30545       "EMPLOYMENT STAT                       87" ;
label variable ER30570       "1988 INTERVIEW NUMBER"                    ;
label variable ER30571       "SEQUENCE NUMBER                       88" ;
label variable ER30572       "RELATION TO HEAD                      88" ;
label variable ER30580       "EMPLOYMENT STAT-IND                   88" ;
label variable ER30606       "1989 INTERVIEW NUMBER"                    ;
label variable ER30607       "SEQUENCE NUMBER                       89" ;
label variable ER30608       "RELATION TO HEAD                      89" ;
label variable ER30616       "EMPLOYMENT STAT-IND                   89" ;
label variable ER30642       "1990 INTERVIEW NUMBER"                    ;
label variable ER30643       "SEQUENCE NUMBER                       90" ;
label variable ER30644       "RELATION TO HEAD                      90" ;
label variable ER30653       "EMPLOYMENT STAT-IND                   90" ;
label variable ER30689       "1991 INTERVIEW NUMBER"                    ;
label variable ER30690       "SEQUENCE NUMBER                       91" ;
label variable ER30691       "RELATION TO HEAD                      91" ;
label variable ER30699       "EMPLOYMENT STAT-IND                   91" ;
label variable ER30733       "1992 INTERVIEW NUMBER"                    ;
label variable ER30734       "SEQUENCE NUMBER                       92" ;
label variable ER30735       "RELATION TO HEAD                      92" ;
label variable ER30744       "EMPLOYMENT STAT                       92" ;
label variable ER30806       "1993 INTERVIEW NUMBER"                    ;
label variable ER30807       "SEQUENCE NUMBER                       93" ;
label variable ER30808       "RELATION TO HEAD                      93" ;
label variable ER30816       "EMPLOYMENT STATUS                     93" ;
label variable ER33101       "1994 INTERVIEW NUMBER"                    ;
label variable ER33102       "SEQUENCE NUMBER                       94" ;
label variable ER33103       "RELATION TO HEAD                      94" ;
label variable ER33111       "EMPLOYMENT STATUS                     94" ;
label variable ER33201       "1995 INTERVIEW NUMBER"                    ;
label variable ER33202       "SEQUENCE NUMBER                       95" ;
label variable ER33203       "RELATION TO HEAD                      95" ;
label variable ER33211       "EMPLOYMENT STATUS                     95" ;
label variable ER33301       "1996 INTERVIEW NUMBER"                    ;
label variable ER33302       "SEQUENCE NUMBER                       96" ;
label variable ER33303       "RELATION TO HEAD                      96" ;
label variable ER33311       "EMPLOYMENT STATUS                     96" ;
label variable ER33401       "1997 INTERVIEW NUMBER"                    ;
label variable ER33402       "SEQUENCE NUMBER                       97" ;
label variable ER33403       "RELATION TO HEAD                      97" ;
label variable ER33411       "EMPLOYMENT STATUS                     97" ;
label variable ER33501       "1999 INTERVIEW NUMBER"                    ;
label variable ER33502       "SEQUENCE NUMBER                       99" ;
label variable ER33503       "RELATION TO HEAD                      99" ;
label variable ER33512       "EMPLOYMENT STATUS                     99" ;
label variable ER33601       "2001 INTERVIEW NUMBER"                    ;
label variable ER33602       "SEQUENCE NUMBER                       01" ;
label variable ER33603       "RELATION TO HEAD                      01" ;
label variable ER33612       "EMPLOYMENT STATUS                     01" ;
label variable ER33701       "2003 INTERVIEW NUMBER"                    ;
label variable ER33702       "SEQUENCE NUMBER                       03" ;
label variable ER33703       "RELATION TO HEAD                      03" ;
label variable ER33712       "EMPLOYMENT STATUS                     03" ;
label variable ER33801       "2005 INTERVIEW NUMBER"                    ;
label variable ER33802       "SEQUENCE NUMBER                       05" ;
label variable ER33803       "RELATION TO HEAD                      05" ;
label variable ER33813       "EMPLOYMENT STATUS                     05" ;
label variable ER33901       "2007 INTERVIEW NUMBER"                    ;
label variable ER33902       "SEQUENCE NUMBER                       07" ;
label variable ER33903       "RELATION TO HEAD                      07" ;
label variable ER33913       "EMPLOYMENT STATUS                     07" ;
label variable ER34001       "2009 INTERVIEW NUMBER"                    ;
label variable ER34002       "SEQUENCE NUMBER                       09" ;
label variable ER34003       "RELATION TO HEAD                      09" ;
label variable ER34016       "EMPLOYMENT STATUS                     09" ;
label variable ER34101       "2011 INTERVIEW NUMBER"                    ;
label variable ER34102       "SEQUENCE NUMBER                       11" ;
label variable ER34103       "RELATION TO HEAD                      11" ;
label variable ER34116       "EMPLOYMENT STATUS                     11" ;
label variable ER34201       "2013 INTERVIEW NUMBER"                    ;
label variable ER34202       "SEQUENCE NUMBER                       13" ;
label variable ER34203       "RELATION TO HEAD                      13" ;
label variable ER34216       "EMPLOYMENT STATUS                     13" ;
label variable ER34301       "2015 INTERVIEW NUMBER"                    ;
label variable ER34302       "SEQUENCE NUMBER                       15" ;
label variable ER34303       "RELATION TO HEAD                      15" ;
label variable ER34317       "EMPLOYMENT STATUS                     15" ;

#delimit cr

********************************************************************************
run ./RawData/PSID_label_define_emp.do

********************************************************************************

drop ER30000 
rename ER30001 famid
rename ER30002 personnumber

rename ER30283 intnumber1979
rename ER30284 sequencenumber1979
rename ER30285 relate1979

rename ER30313 intnumber1980
rename ER30314 sequencenumber1980
rename ER30315 relate1980

rename ER30343 intnumber1981
rename ER30344 sequencenumber1981
rename ER30345 relate1981

rename ER30373 intnumber1982
rename ER30374 sequencenumber1982
rename ER30375 relate1982

rename ER30399 intnumber1983
rename ER30400 sequencenumber1983
rename ER30401 relate1983

rename ER30429 intnumber1984
rename ER30430 sequencenumber1984
rename ER30431 relate1984

rename ER30463 intnumber1985
rename ER30464 sequencenumber1985
rename ER30465 relate1985

rename ER30498 intnumber1986
rename ER30499 sequencenumber1986
rename ER30500 relate1986

rename ER30535 intnumber1987
rename ER30536 sequencenumber1987
rename ER30537 relate1987

rename ER30570 intnumber1988
rename ER30571 sequencenumber1988
rename ER30572 relate1988

rename ER30606 intnumber1989
rename ER30607 sequencenumber1989
rename ER30608 relate1989

rename ER30642 intnumber1990
rename ER30643 sequencenumber1990
rename ER30644 relate1990

rename ER30689 intnumber1991
rename ER30690 sequencenumber1991
rename ER30691 relate1991

rename ER30733 intnumber1992
rename ER30734 sequencenumber1992
rename ER30735 relate1992

rename ER30806 intnumber1993
rename ER30807 sequencenumber1993
rename ER30808 relate1993

rename ER33101 intnumber1994
rename ER33102 sequencenumber1994
rename ER33103 relate1994

rename ER33201 intnumber1995
rename ER33202 sequencenumber1995
rename ER33203 relate1995

rename ER33301 intnumber1996
rename ER33302 sequencenumber1996
rename ER33303 relate1996

rename ER33401 intnumber1997
rename ER33402 sequencenumber1997
rename ER33403 relate1997

rename ER33501 intnumber1999
rename ER33502 sequencenumber1999
rename ER33503 relate1999

rename ER33601 intnumber2001
rename ER33602 sequencenumber2001
rename ER33603 relate2001

rename ER33701 intnumber2003
rename ER33702 sequencenumber2003
rename ER33703 relate2003

rename ER33801 intnumber2005
rename ER33802 sequencenumber2005
rename ER33803 relate2005

rename ER33901 intnumber2007
rename ER33902 sequencenumber2007
rename ER33903 relate2007

rename ER34001 intnumber2009
rename ER34002 sequencenumber2009
rename ER34003 relate2009

rename ER34101 intnumber2011
rename ER34102 sequencenumber2011
rename ER34103 relate2011

rename ER34201 intnumber2013
rename ER34202 sequencenumber2013
rename ER34203 relate2013

rename ER34301 intnumber2015
rename ER34302 sequencenumber2015
rename ER34303 relate2015

rename ER30293 empstatus1979
rename ER30323 empstatus1980 
rename ER30353 empstatus1981
rename ER30382 empstatus1982
rename ER30411 empstatus1983
rename ER30441 empstatus1984
rename ER30474 empstatus1985
rename ER30509 empstatus1986
rename ER30545 empstatus1987
rename ER30580 empstatus1988
rename ER30616 empstatus1989
rename ER30653 empstatus1990
rename ER30699 empstatus1991
rename ER30744 empstatus1992
rename ER30816 empstatus1993
rename ER33111 empstatus1994 
rename ER33211 empstatus1995
rename ER33311 empstatus1996
rename ER33411 empstatus1997
rename ER33512 empstatus1999
rename ER33612 empstatus2001
rename ER33712 empstatus2003
rename ER33813 empstatus2005
rename ER33913 empstatus2007
rename ER34016 empstatus2009
rename ER34116 empstatus2011
rename ER34216 empstatus2013
rename ER34317 empstatus2015

* Variable to merge in these variables to child
	gen son_id = famid*1000 + personnumber

save ./RawData/PSID_raw_indfam_empvar.dta, replace

